package com.lyl.syt.controller;

import com.lyl.syt.common.result.Result;
import com.lyl.syt.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(tags = "OSS管理")
@RestController
@RequestMapping("/api/oss/file")
@RequiredArgsConstructor
public class FileApiController {
    private final FileService fileService;

    @ApiOperation("文件上传")
    @PostMapping("/uploadFile")
    public Result uploadFile(MultipartFile file){
        //上传文件到阿里云，获取url
        String url = fileService.uploadFile(file);
        return Result.ok(url);
    }
}
